package com.fivium.bpd.editor;

import java.awt.BorderLayout;

import javax.swing.JPanel;
import javax.swing.JTabbedPane;

import com.fivium.bpd.component.BusinessProcessDefinition;
import com.mxgraph.view.mxGraph;

public class BPDPanel extends JPanel
{
  private BusinessProcessDefinition businessProcessDefinition_;
  
  /**
   * Create the application.
   */
  public BPDPanel(BusinessProcessDefinition businessProcessDefinition)
  {
    businessProcessDefinition_ = businessProcessDefinition;
    
    setLayout(new BorderLayout(0, 0));
    
    JTabbedPane componentContainer = new JTabbedPane(JTabbedPane.BOTTOM);
    add(componentContainer);
    
    JPanel delegationAssignmentPanel = new DelegationAssignmentPanel(businessProcessDefinition_);
    componentContainer.addTab("Delegation/Assignments", null, delegationAssignmentPanel, null);
    
    JPanel bpmEditorPanel =  new GraphPanel(new GraphComponent(new mxGraph(), businessProcessDefinition));
    componentContainer.addTab("Business Process Model", null, bpmEditorPanel, null);
    
    JPanel queryEditorPanel = new QueryPanel(businessProcessDefinition_);
    componentContainer.addTab("Queries", null, queryEditorPanel, null);
    
    JPanel xmlPanel = new XMLPanel();
    componentContainer.addTab("XML", null, xmlPanel, null);
    
    componentContainer.setSelectedIndex(1);
  }
  
  public BusinessProcessDefinition getBusinessProcessDefinition()
  {
    return businessProcessDefinition_;
  }
}
